let oInput = document.querySelector(".buttontwo");
let oinputone = document.querySelector(".inputone")
let oinputtwo = document.querySelector(".inputtwo")
oInput.onclick = function() {
	let xhr = new XMLHttpRequest();
	xhr.open("post", "1zhuce.php", true);
	//1.设置请求头
	//将数据参数以form表单的形式发送
	xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	//2.将键值对参数写入至send
	//key1=value1&key2=value2...


	// "userId="+this.value
	// "usePassword="+this.value
	xhr.send("userId=" + oinputone.value + "&" + "usePassword=" + oinputtwo.value);
	// Key=value&key2=value2
	xhr.onreadystatechange = function() {
		if (xhr.status == 200 && xhr.readyState == 4) {
			fun(xhr.responseText);
		}
	}
}

function fun(resText) {
	let oSpan = document.querySelector("#span");

	//前后端分离
	if (resText == "1") {
		oSpan.innerHTML = "不能注册";
	} else if (resText == "0") {
		oSpan.innerHTML = "可以注册";
		location.href = "2denglu.html"
	}

}
